i = 0
for num in range(2,20000):
    if num == 2:
        print(num,end=' ')
        i = i+1
    else:
        a = 2
        while a<num:
            if num%a == 0:
                break
            a = a+1
        else:
            print(num,end=' ')
            i = i+1
    if i%5 == 0:
        print('\n')







